package com.victor9ac.mashup.usecase;

import com.victor9ac.mashup.api.Images;
import com.victor9ac.mashup.contract.ImagesContract;
import com.victor9ac.mashup.port.ImageOperation;

public class ImageUseCase implements ImagesContract {
	
	private static final int MAX_ALLOWED_IMAGES = 20;
	ImageOperation imageOperation;


	public Images getMainImagesByKeyword(String key){
		
		Images images = imageOperation.getImageFromKeyword(key);
		
		
		if (images != null && images.size() > MAX_ALLOWED_IMAGES){
			images.subList(MAX_ALLOWED_IMAGES);
		}
		
		
		return images;
	}
	
	public void setImageOperation(ImageOperation imageOperation) {
		this.imageOperation = imageOperation;
	}


}
